//---------------------------------------------------------------------------- // File: C3DTextures.h // Class: C3DVertices [v1.4] -- Common 3D Vertices Class // Type: 3D Object // Author: Ken Anderson // Date: 10/13/04 // // Versions: // 1.2[3/28/05] -- C3DTexture updated to accept a media file that will contain specific // image data held in memory. // a) SetTexture overloaded. // b) SetTexture updated to create & copy CiMedia to internal CiMedia object. // c) Destructor updated to clean up the CiMedia File // 1.3[6/11/05] -- Memory leak detected when a new texture is set, the old method of releasing // a texture was still in place. SetTexture now calls the Cleanup routine, which // has the correct method of releasing the texture. // 1.4[6/19/05] -- Updated to use both a pointer to a CiMedia object or a copy parameter. // // OS dependant: NA // Desc: A class designated to manage texture loading. // // Notes: // Required headers: // 1) C3DTypes.h -- Contains structures, error codes, & enumations the class // relies on. // 2) Banks3d.h -- Contains a list of renderbanks used by the common & renderer system. // 3) CRSGlobal.h -- Contains the global CRS Manager. There is only one CRS Manager // per system. //---------------------------------------------------------------------------- #ifndef __C3DTEXS__ #define __C3DTEXS__ #include "OS_Global.h" #include "Common.h" #include "Banks3d.h" #include "CRSGlobal.h" #include "StringPlus.h" class C3DTextures { private: /////////////////////////////////////////////////////////////////////////////////////////////////////// // Member Variable: m_pTextures // Desc: A pointer to a structure that contains texture info. //////////////////////////////////////////////////////////////////////////////////////////////////// PSC3DTextures m_pTextures; /////////////////////////////////////////////////////////////////////////////////////////////////////// // Member Variable: m_hCallback // Desc: A handle to RBE (Render Bank Element) for updating. //////////////////////////////////////////////////////////////////////////////////////////////////// HRBE m_hCallback; public: //Constructor & Destructor C3DTextures(); C3DTextures(const C3DTextures& textures); ~C3DTextures(); //Render directors C3DERR Render(Byte byStage = 0); //Texture controllers C3DERR SetTexture(CiMedia* pMedia); C3DERR SetTexture(CiMedia media); C3DERR SetTexture(StringPlus& sTexture); /////////////////////////////////////////////////////////////////////////////////////////////////////// // Name: SetTexture -- OVERLOADED // Date: 10/13/04 // *Tested: 6/19/5 // Type: Common 3D Object. // Desc: Loads a texture from a file. // Parameters: // 1) string& sTexture == A reference to a stl string object that will be the name of the texture. // Return value: // C3DERR == An error code returned by the C3DVertices, please review C3DTypes.h for more information on // each code status. ////////////////////////////////////////////////////////////////////////////////////////////////////// inline C3DERR SetTexture(string& s){return SetTexture((StringPlus&)s);} /////////////////////////////////////////////////////////////////////////////////////////////////////// // Name: ReturnTextureName // Date: 10/15/06 // Desc: Returns the current texture in StringPlus form. // *Tested: 10/15/06 // Parameters: // 1) StringPlus& == A reference to a StringPlus object that contains the texture's name. // Return value: None ////////////////////////////////////////////////////////////////////////////////////////////////////// inline void ReturnTexture(StringPlus& s){if(m_pTextures!=NULL) s=m_pTextures->sTexture; } /////////////////////////////////////////////////////////////////////////////////////////////////////// // Name: ReturnTextureName // Date: 10/15/06 // Desc: Returns the current texture in stl string form. // *Tested: 10/15/06 // Parameters: None // Return value: // string& == Returns a reference to a stl string object that contains the texture's name. ////////////////////////////////////////////////////////////////////////////////////////////////////// inline string& ReturnTexture(){string s;return ((m_pTextures!=NULL)?m_pTextures->sTexture:s);} private: void ReleaseTexture(); }; #endif